package com.platform.hjt.erp.model;

import java.sql.Timestamp;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import com.platform.hjt.sys.model.SysCompanyInfo;
import com.platform.hjt.sys.model.json.SysCompanyInfoSerialize;

/**
 * ErpGoodInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "erp_good_info")
public class ErpGoodInfo implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -2497623109550643194L;
	private String erpGoodInfoId;
	private SysCompanyInfo sysCompanyInfo;
	@NotBlank(message="名称不能为空")
	@Length(max=100, message="名称长度不能超过100个字")
	private String goodName;
	@NotBlank(message="编码不能为空")
	@Length(max=100, message="编码长度不能超过100个字")
	private String goodCode;
	@NotNull(message="成本价不能为空")
	@Min(value=0, message="成本价不能为负数")
	private Double goodCostPrice;
	@NotNull(message="销售价不能为空")
	@Min(value=0, message="销售价不能为负数")
	private Double goodSellPrice;
	@NotBlank(message="请选择单位")
	private String goodUnit;
	private Timestamp createTime;
	private Boolean isDel;
	private Integer sortIndex;
	
	private String fullPinyin;
	private String shortPinyin;

	// Constructors

	/** default constructor */
	public ErpGoodInfo() {
	}

	/** minimal constructor */
	public ErpGoodInfo(String erpGoodInfoId) {
		this.erpGoodInfoId = erpGoodInfoId;
	}

	/** full constructor */
	public ErpGoodInfo(String erpGoodInfoId, SysCompanyInfo sysCompanyInfo,
			String goodName, Double goodCostPrice, Double goodSellPrice,
			String goodUnit, Timestamp createTime, Boolean isDel,
			Integer sortIndex, Set<ErpStorageFlowDetail> erpStorageFlowDetails) {
		this.erpGoodInfoId = erpGoodInfoId;
		this.sysCompanyInfo = sysCompanyInfo;
		this.goodName = goodName;
		this.goodCostPrice = goodCostPrice;
		this.goodSellPrice = goodSellPrice;
		this.goodUnit = goodUnit;
		this.createTime = createTime;
		this.isDel = isDel;
		this.sortIndex = sortIndex;
	}

	// Property accessors
	@Id
	@GenericGenerator(name="systemUUID",strategy="uuid")
	@GeneratedValue(generator="systemUUID")
	@Column(name = "erp_good_info_id", unique = true, nullable = false, length = 32)
	public String getErpGoodInfoId() {
		return this.erpGoodInfoId;
	}

	public void setErpGoodInfoId(String erpGoodInfoId) {
		this.erpGoodInfoId = erpGoodInfoId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "sys_company_info_id")
	@JsonSerialize(using = SysCompanyInfoSerialize.class)
	public SysCompanyInfo getSysCompanyInfo() {
		return this.sysCompanyInfo;
	}

	public void setSysCompanyInfo(SysCompanyInfo sysCompanyInfo) {
		this.sysCompanyInfo = sysCompanyInfo;
	}

	@Column(name = "good_name", length = 200)
	public String getGoodName() {
		return this.goodName;
	}

	public void setGoodName(String goodName) {
		this.goodName = goodName;
	}

	@Column(name = "good_code", length = 200)
	public String getGoodCode() {
		return goodCode;
	}

	public void setGoodCode(String goodCode) {
		this.goodCode = goodCode;
	}

	@Column(name = "good_cost_price", precision = 22, scale = 0)
	public Double getGoodCostPrice() {
		return this.goodCostPrice;
	}

	public void setGoodCostPrice(Double goodCostPrice) {
		this.goodCostPrice = goodCostPrice;
	}

	@Column(name = "good_sell_price", precision = 22, scale = 0)
	public Double getGoodSellPrice() {
		return this.goodSellPrice;
	}

	public void setGoodSellPrice(Double goodSellPrice) {
		this.goodSellPrice = goodSellPrice;
	}

	@Column(name = "good_unit", length = 1)
	public String getGoodUnit() {
		return this.goodUnit;
	}

	public void setGoodUnit(String goodUnit) {
		this.goodUnit = goodUnit;
	}

	@Column(name = "create_time", length = 19)
	public Timestamp getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	@Column(name = "is_del")
	public Boolean getIsDel() {
		return this.isDel;
	}

	public void setIsDel(Boolean isDel) {
		this.isDel = isDel;
	}

	@Column(name = "sort_index")
	public Integer getSortIndex() {
		return this.sortIndex;
	}

	public void setSortIndex(Integer sortIndex) {
		this.sortIndex = sortIndex;
	}

	@Column(name = "full_pinyin")
	public String getFullPinyin() {
		return fullPinyin;
	}

	public void setFullPinyin(String fullPinyin) {
		this.fullPinyin = fullPinyin;
	}

	@Column(name = "short_pinyin")
	public String getShortPinyin() {
		return shortPinyin;
	}

	public void setShortPinyin(String shortPinyin) {
		this.shortPinyin = shortPinyin;
	}

}